package fr.mairie.parc.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import fr.mairie.parc.domain.Commande;

public class CommandeResultSetExtractor implements ResultSetExtractor {

	@Override
	public Object extractData(ResultSet rs) throws SQLException,
			DataAccessException {
		Commande commande = new Commande();
		commande.setIdCommande(rs.getInt(1));
		commande.setQuantite(rs.getInt(2));
		commande.setDateCommande(rs.getDate(3));
		commande.setNumDevis(rs.getString(4));
		commande.setFournisseur(rs.getString(5));
		commande.setMateriel(rs.getString(6));
		commande.setEtat(rs.getString(7));
		commande.setMarque(rs.getString(8));
		commande.setModele(rs.getString(9));
		commande.setStock(rs.getString(10));
		commande.setPrix(rs.getDouble(11));
		commande.setCommentaire(rs.getString(12));
		commande.setDateLivraison(rs.getDate(13));

		return commande;
	}

}
